#include "miscutils.h"

/*
 * die: aborta a execução e exibe mesagem de erro
 */
int die(char *msg){
	fprintf(stderr, "error: %s\n", msg);
	exit(1);
	return 1;
}

/*
 * dieHelp: aborta a execução, exibe mensagem de erro e oferece ajuda
 */
int dieHelp(char *msg){
	fprintf(stderr, "error: %s\ntry cypress help for help\n", msg);
	exit(1);
	return 1;
}

/*
 * warning: imprime um aviso e oferece ajuda
 */
int warning(char *msg){
	fprintf(stderr, "warning: %s, try cypress for help\n", msg);
	return 1;
}

/*
 * showUsage: mostra o uso do programa
 */
int showUsage(){
	fprintf(stderr, "cypress alpha1: a program to solve linear programming problems\nusing the simplex method\nusage: cypress <filename> [options]\nfile must contain problem dimensions, vector of costs, vector of resources\nand matrix of restrictions, in this order. problem must be in canonical form.\noptions:\n-v: verbose on\n-s: print statistics\n-p <unsigned int>: number of decimal digits of precision [default=7]\n");
	exit(1);
	return 1;
}

/*
 * equals: retorna 1 se dois doubles forem iguais, dada
 * uma precisão de mu_delta
 */
int equals(double a, double b){
    return ((fabs(a - b)) < mu_delta);
}

